//package com.pengzy.core.gateway_security;
//
//import cn.hutool.extra.servlet.ServletUtil;
//import com.pengzy.comment.core.annotation.ApiLog;
//import com.pengzy.comment.core.enums.OperateEnum;
//import com.pengzy.comment.core.utils.AddressUtils;
//import com.pengzy.comment.core.utils.JsonUtils;
//import com.pengzy.comment.mybatis.entity.SysLog;
//import com.pengzy.comment.web.aop.LogFilterExecutoServer;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.http.server.reactive.ServerHttpResponse;
//import org.springframework.stereotype.Component;
//import org.springframework.util.MultiValueMap;
//import org.springframework.web.server.ServerWebExchange;
//import org.springframework.web.server.WebFilter;
//import org.springframework.web.server.WebFilterChain;
//import reactor.core.publisher.Mono;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.time.LocalDateTime;
//import java.util.Map;
//import java.util.Objects;
//
///**
// * @author xiaozhi 2023/7/18
// */
////@Component
//@Slf4j
//public class LoginFilter
//        implements WebFilter {
//
//
//    @Resource
//    private LogFilterExecutoServer logFilterExecutoServer;
//
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
////        ServerHttpRequest request = exchange.getRequest();
////        ServerHttpResponse response = exchange.getResponse();
////        if(request.getURI().getPath().endsWith("/login")){
////            logAdd(request,response);
////        }
//        return chain.filter(exchange);
//    }
//
//
//    public void logAdd( ServerHttpRequest request,ServerHttpResponse response){
//        SysLog sysLog=new SysLog();
//        sysLog.setUsername("pengzy");
//        sysLog.setType(OperateEnum.LOGIN.getInfo());
//        sysLog.setOperation("登录");
//        String ip = Objects.requireNonNull(request.getRemoteAddress()).getAddress().getHostAddress();
//        sysLog.setIp(ip);
//        sysLog.setRequest(request.getMethodValue());
//        sysLog.setStatus("OK");
//        sysLog.setDict(AddressUtils.getRealAddressByIP(sysLog.getIp()));
//        sysLog.setRequestDict(request.getURI().getPath());
//        sysLog.setMethod("com.pengzy.auth.controller.LoginController.login()");
//        sysLog.setParam(request.getQueryParams().toString());
//        sysLog.setResponse("");
//        sysLog.setCreateTime(LocalDateTime.now());
//        logFilterExecutoServer.init(sysLog);
//    }
//
//}
